import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/event/event_model.dart';
import 'package:meal/route/route.dart';
import 'package:meal/ui/draw_under_line.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

class StoreVoucher extends StatefulWidget {
  final bool isAll;

  const StoreVoucher({Key? key, this.isAll = false}) : super(key: key);

  @override
  State<StoreVoucher> createState() => _StoreVoucherState();
}

class _StoreVoucherState extends State<StoreVoucher> with SingleTickerProviderStateMixin {
  GlobalKey status = GlobalKey();

  OverlayEntry? overlayEntry;

  late AnimationController controller;

  late Animation<double> animation;

  TextStyle get defaultStyle {
    return StylesUtils.customTextStyle(
        color: ColorsUtils.colorCc0, fontSize: Sizes.default13, lineHeight: 1.5);
  }

  TextStyle get style {
    return StylesUtils.customTextStyle(color: ColorsUtils.colorFb8, fontSize: Sizes.default15);
  }

  TextStyle get redStyle {
    return StylesUtils.customTextStyle(
        color: ColorsUtils.colorFb8, fontSize: Sizes.default13, lineHeight: 1.5);
  }

  @override
  void initState() {
    super.initState();
    controller = AnimationController(duration: const Duration(milliseconds: 300), vsync: this);
    animation = CurvedAnimation(parent: controller, curve: Curves.linear);
    controller.reverse();
    globalBus.on<ClosedOverlayEntryEvent>().listen((ClosedOverlayEntryEvent event) {
      dismissOverlay();
    });
  }

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        children: [
          Container(
            margin: const EdgeInsets.all(Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            child: ListBody(
              children: [
                DrawUnderLine(
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  child: Container(
                    padding: const EdgeInsets.only(
                        bottom: Sizes.default20,
                        top: Sizes.default10,
                        left: Sizes.default15,
                        right: Sizes.default15),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Expanded(
                          flex: 1,
                          child: Container(
                            alignment: Alignment.topLeft,
                            child: Text(
                              'No.999',
                              style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                            ),
                          ),
                        ),
                        Expanded(
                          flex: 5,
                          child: Container(
                            padding: const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text(
                                        '代金券',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default16, color: ColorsUtils.colorFf6),
                                      ),
                                      Container(
                                        constraints: const BoxConstraints.expand(
                                            width: Sizes.default70, height: Sizes.default20),
                                        alignment: Alignment.center,
                                        decoration: BoxDecoration(
                                            color: ColorsUtils.rgba(251, 137, 116, 1),
                                            borderRadius: BorderRadius.circular(Sizes.default10)),
                                        child: Text.rich(TextSpan(children: [
                                          WidgetSpan(
                                              child: ToolsUtils.getUrlSvg(
                                                  'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3043.svg',
                                                  width: Sizes.default13,
                                                  height: Sizes.default13),
                                              alignment: PlaceholderAlignment.middle),
                                          TextSpan(
                                              text: '审核中',
                                              style: StylesUtils.customTextStyle(
                                                  fontSize: Sizes.default12))
                                        ])),
                                      )
                                    ],
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                                  child: Text(
                                    '优惠金额：50P（满500P可用）',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Text(
                                    '发放数量：0/1000',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '发放日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '可用日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '使用方式：移动端',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '其他说明：当顾客参与此活动时无法享受店铺满减，仅限店铺新用户可用',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '创建时间：2021-11-30 10:09:37',
                                    style: redStyle,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: Sizes.default60,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Expanded(
                          child: Center(
                        child: TextButton(onPressed: () {}, child: Text('', style: style)),
                      )),
                      Expanded(
                          child: Center(
                        child: TextButton(
                            onPressed: () {
                              Get.toNamed(RouteGet.marketStoreEditVoucher);
                            },
                            child: Text('编辑活动', style: style)),
                      ))
                    ],
                  ),
                )
              ],
            ),
          ),
          Container(
            margin: const EdgeInsets.all(Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            child: ListBody(
              children: [
                DrawUnderLine(
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  child: Container(
                    padding: const EdgeInsets.only(
                        bottom: Sizes.default20,
                        top: Sizes.default10,
                        left: Sizes.default15,
                        right: Sizes.default15),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Expanded(
                          flex: 1,
                          child: Container(
                            alignment: Alignment.topLeft,
                            child: Text(
                              'No.998',
                              style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                            ),
                          ),
                        ),
                        Expanded(
                          flex: 5,
                          child: Container(
                            padding: const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text(
                                        '代金券',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default16, color: ColorsUtils.colorFf6),
                                      ),
                                      Container(
                                        constraints: const BoxConstraints.expand(
                                            width: Sizes.default70, height: Sizes.default20),
                                        alignment: Alignment.center,
                                        decoration: BoxDecoration(
                                            color: ColorsUtils.rgba(82, 190, 237, 1),
                                            borderRadius: BorderRadius.circular(Sizes.default10)),
                                        child: Text.rich(TextSpan(children: [
                                          WidgetSpan(
                                              child: ToolsUtils.getUrlSvg(
                                                  'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u2984.svg',
                                                  width: Sizes.default13,
                                                  height: Sizes.default13),
                                              alignment: PlaceholderAlignment.middle),
                                          TextSpan(
                                              text: '未开始',
                                              style: StylesUtils.customTextStyle(
                                                  fontSize: Sizes.default12))
                                        ])),
                                      )
                                    ],
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                                  child: Text(
                                    '优惠金额：50P（满500P可用）',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Text(
                                    '发放数量：0/1000',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '发放日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '可用日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '使用方式：移动端',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '其他说明：当顾客参与此活动时无法享受店铺满减，仅限店铺新用户可用',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '创建时间：2021-11-30 10:09:37',
                                    style: redStyle,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: Sizes.default60,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Expanded(
                          child: Center(
                        child: TextButton(
                            onPressed: () {
                              pauseActivity();
                            },
                            child: Text('暂停发放', style: style)),
                      )),
                      Expanded(
                          child: Center(
                        child: TextButton(
                            onPressed: () {
                              Get.toNamed(RouteGet.marketStoreEditVoucher);
                            },
                            child: Text('编辑活动', style: style)),
                      ))
                    ],
                  ),
                )
              ],
            ),
          ),
          Container(
            margin: const EdgeInsets.all(Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            child: ListBody(
              children: [
                DrawUnderLine(
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  child: Container(
                    padding: const EdgeInsets.only(
                        bottom: Sizes.default20,
                        top: Sizes.default10,
                        left: Sizes.default15,
                        right: Sizes.default15),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Expanded(
                          flex: 1,
                          child: Container(
                            alignment: Alignment.topLeft,
                            child: Text(
                              'No.997',
                              style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                            ),
                          ),
                        ),
                        Expanded(
                          flex: 5,
                          child: Container(
                            padding: const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text(
                                        '代金券',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default16, color: ColorsUtils.colorFf6),
                                      ),
                                      Container(
                                        constraints: const BoxConstraints.expand(
                                            width: Sizes.default70, height: Sizes.default20),
                                        alignment: Alignment.center,
                                        decoration: BoxDecoration(
                                            color: ColorsUtils.rgba(0, 102, 204, 1),
                                            borderRadius: BorderRadius.circular(Sizes.default10)),
                                        child: Text.rich(TextSpan(children: [
                                          WidgetSpan(
                                              child: ToolsUtils.getUrlSvg(
                                                  'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u2984.svg',
                                                  width: Sizes.default13,
                                                  height: Sizes.default13),
                                              alignment: PlaceholderAlignment.middle),
                                          TextSpan(
                                              text: '进行中',
                                              style: StylesUtils.customTextStyle(
                                                  fontSize: Sizes.default12))
                                        ])),
                                      )
                                    ],
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                                  child: Text(
                                    '优惠金额：50P（满500P可用）',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Text(
                                    '发放数量：20/1000',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '发放日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '可用日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '使用方式：移动端',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '其他说明：当顾客参与此活动时无法享受店铺满减，店铺所有用户可用',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '创建时间：2021-11-30 10:09:37',
                                    style: redStyle,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: Sizes.default60,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Expanded(
                          child: Center(
                        child: TextButton(
                            onPressed: () {
                              pauseActivity('是否恢复此活动?');
                            },
                            child: Text('暂停发放', style: style)),
                      )),
                      Expanded(
                          child: Center(
                        child: TextButton(
                            onPressed: () {
                              Get.toNamed(RouteGet.marketStoreInfoVoucher);
                            },
                            child: Text('使用详情', style: style)),
                      ))
                    ],
                  ),
                )
              ],
            ),
          ),
          Container(
            margin: const EdgeInsets.all(Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            child: ListBody(
              children: [
                DrawUnderLine(
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  child: Container(
                    padding: const EdgeInsets.only(
                        bottom: Sizes.default20,
                        top: Sizes.default10,
                        left: Sizes.default15,
                        right: Sizes.default15),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Expanded(
                          flex: 1,
                          child: Container(
                            alignment: Alignment.topLeft,
                            child: Text(
                              'No.997',
                              style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                            ),
                          ),
                        ),
                        Expanded(
                          flex: 5,
                          child: Container(
                            padding: const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text(
                                        '代金券',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default16, color: ColorsUtils.colorFf6),
                                      ),
                                      Container(
                                        constraints: const BoxConstraints.expand(
                                            width: Sizes.default70, height: Sizes.default20),
                                        alignment: Alignment.center,
                                        decoration: BoxDecoration(
                                            color: ColorsUtils.rgba(204, 204, 204, 1),
                                            borderRadius: BorderRadius.circular(Sizes.default10)),
                                        child: Text.rich(TextSpan(children: [
                                          WidgetSpan(
                                              child: ToolsUtils.getUrlSvg(
                                                  'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u2984.svg',
                                                  width: Sizes.default13,
                                                  height: Sizes.default13),
                                              alignment: PlaceholderAlignment.middle),
                                          TextSpan(
                                              text: '已结束',
                                              style: StylesUtils.customTextStyle(
                                                  fontSize: Sizes.default12))
                                        ])),
                                      )
                                    ],
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                                  child: Text(
                                    '优惠金额：50P（满500P可用）',
                                    style: defaultStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Text(
                                    '发放数量：909/1000',
                                    style: defaultStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '发放日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '可用日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '使用方式：移动端',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '其他说明：当顾客参与此活动时无法享受店铺满减，店铺所有用户可用',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '创建时间：2021-11-30 10:09:37',
                                    style: redStyle,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: Sizes.default60,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Expanded(
                          child: Center(
                        child: TextButton(onPressed: () {}, child: Text('', style: style)),
                      )),
                      Expanded(
                          child: Center(
                        child: TextButton(
                            onPressed: () {
                              Get.toNamed(RouteGet.marketStoreInfoVoucher);
                            },
                            child: Text('使用详情', style: style)),
                      ))
                    ],
                  ),
                )
              ],
            ),
          ),
          Container(
            margin: const EdgeInsets.all(Sizes.default20),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
            child: ListBody(
              children: [
                DrawUnderLine(
                  color: ColorsUtils.parseColorFromHexString('#D7D7D7'),
                  child: Container(
                    padding: const EdgeInsets.only(
                        bottom: Sizes.default20,
                        top: Sizes.default10,
                        left: Sizes.default15,
                        right: Sizes.default15),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Expanded(
                          flex: 1,
                          child: Container(
                            alignment: Alignment.topLeft,
                            child: Text(
                              'No.997',
                              style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                            ),
                          ),
                        ),
                        Expanded(
                          flex: 5,
                          child: Container(
                            padding: const EdgeInsets.only(left: Sizes.default10),
                            child: Column(
                              children: [
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text(
                                        '代金券',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default16, color: ColorsUtils.colorFf6),
                                      ),
                                      SizedBox(
                                        child: Stack(
                                          children: [
                                            InkWell(
                                              onTap: showOverlay,
                                              child: Container(
                                                key: status,
                                                constraints: const BoxConstraints.expand(
                                                    width: Sizes.default70,
                                                    height: Sizes.default20),
                                                alignment: Alignment.center,
                                                decoration: BoxDecoration(
                                                    color: ColorsUtils.rgba(255, 0, 0, 1),
                                                    borderRadius:
                                                        BorderRadius.circular(Sizes.default10)),
                                                child: Text.rich(TextSpan(children: [
                                                  WidgetSpan(
                                                      child: ToolsUtils.getUrlSvg(
                                                          'https://cdn7.axureshop.com/demo/1525603/images/团购管理/u3043.svg',
                                                          width: Sizes.default13,
                                                          height: Sizes.default13),
                                                      alignment: PlaceholderAlignment.middle),
                                                  TextSpan(
                                                      text: '审核失败',
                                                      style: StylesUtils.customTextStyle(
                                                          fontSize: Sizes.default12))
                                                ])),
                                              ),
                                            )
                                          ],
                                        ),
                                      )
                                    ],
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                                  child: Text(
                                    '优惠金额：50P（满500P可用）',
                                    style: defaultStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  child: Text(
                                    '发放数量：909/1000',
                                    style: defaultStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '发放日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '可用日期：2021-11-01 至 2021-11-30',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '使用方式：移动端',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '其他说明：当顾客参与此活动时无法享受店铺满减，店铺所有用户可用',
                                    style: redStyle,
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.topLeft,
                                  margin: const EdgeInsets.only(top: Sizes.default10),
                                  child: Text(
                                    '创建时间：2021-11-30 10:09:37',
                                    style: redStyle,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: Sizes.default60,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Expanded(
                          child: Center(
                        child: TextButton(onPressed: () {}, child: Text('', style: style)),
                      )),
                      Expanded(
                          child: Center(
                        child: TextButton(
                            onPressed: () {
                              Get.toNamed(RouteGet.marketStoreInfoVoucher);
                            },
                            child: Text('使用详情', style: style)),
                      ))
                    ],
                  ),
                )
              ],
            ),
          ),
        ],
      ),
    );
  }

  void pauseActivity([String title = '是否暂停此活动?']) async {
    final dialog = BrnDialog(
        verticalDivider: const VerticalDivider(
          width: 1.0,
          color: Colors.black,
        ),
        divider: const Divider(
          height: 1.0,
          color: Colors.black,
        ),
        contentWidget: ListBody(
          children: [
            Container(
              padding: const EdgeInsets.symmetric(vertical: Sizes.default15),
              alignment: Alignment.center,
              child: Text(
                title,
                style: StylesUtils.customTextStyle(
                    color: ColorsUtils.color000, fontSize: Sizes.default18),
              ),
            ),
          ],
        ),
        actionsWidget: [
          Container(
              alignment: Alignment.center,
              child: TextButton(
                onPressed: () {
                  Navigator.pop(context, 0);
                },
                child: Text(
                  '取消',
                  style: StylesUtils.customTextStyle(
                      color: ColorsUtils.color333, fontSize: Sizes.default16),
                ),
              )),
          Container(
              alignment: Alignment.center,
              child: TextButton(
                onPressed: () {
                  Navigator.pop(context, 1);
                },
                child: Text('确定',
                    style: StylesUtils.customTextStyle(
                        fontSize: Sizes.default16, color: ColorsUtils.colorFf6)),
              ))
        ],
        themeData: BrnDialogConfig(
            dialogWidth: 280,
            radius: Sizes.default10,
            titlePaddingSm: EdgeInsets.zero,
            titlePaddingLg: EdgeInsets.zero,
            contentPaddingSm: EdgeInsets.zero,
            contentPaddingLg: EdgeInsets.zero,
            contentTextAlign: TextAlign.center));
    int? result = await showDialog<int>(
      context: context,
      barrierDismissible: true,
      builder: (BuildContext context) {
        return dialog;
      },
    );
    if (result == 1) {
      /// 拨打电话
    }
  }

  void showOverlay() {
    if (overlayEntry != null) {
      controller.reverse();
      return delayedOverlay();
    }

    ///1、获取OverlayState
    OverlayState overlayState = Overlay.of(context);

    ///2、创建OverlayEntry
    overlayEntry = OverlayEntry(
      builder: (ctx) {
        //获取_bizStatusKey Widget的位置，用于设置OverlayEntry将悬浮的位置
        RenderBox? renderBox = status.currentContext?.findRenderObject() as RenderBox?;
        Size size = renderBox?.size ?? Size.zero;
        Offset offset = renderBox?.localToGlobal(Offset.zero) ?? Offset.zero;
        final double top = offset.dy + size.height + 5;
        double width = 200;
        double left = offset.dx - width;
        final mate = Material(
            borderRadius: BorderRadius.circular(Sizes.default5),
            color: Colors.black.withOpacity(0.7),
            child: ScaleTransition(
              scale: animation,
              child: InkWell(
                onTap: dismissOverlay,
                child: Container(
                  width: width,
                  padding: const EdgeInsets.only(left: 10, top: 7, bottom: 7, right: 10),
                  child: Text(
                    '原因：优惠金额过于接近达标金额，请修改后重新提交审核。',
                    style: StylesUtils.customTextStyle(fontSize: Sizes.default12, lineHeight: 1.5),
                  ),
                ),
              ),
            ));
        return Positioned(
          top: top,
          left: left,
          child: mate,
        );
      },
    );

    ///3、将OverlayEntry插入到Overlay中。
    overlayState.insert(overlayEntry!);
    controller.forward();
  }

  void dismissOverlay() {
    if (overlayEntry != null) {
      controller.reverse();
      delayedOverlay();
    }
  }

  void delayedOverlay() {
    Future.delayed(const Duration(milliseconds: 100), () {
      overlayEntry?.remove();
      overlayEntry = null;
    });
  }
}